<?php
/**
 * Zead
 *
 * LICENSE	
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/bsd-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to eu@marcelomx.com so we can send you a copy immediately.
 *
 * @category   Zead
 * @author     Marcelo Rodrigues Gonzaga <eu@marcelomx.com>
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga
 * @link       http://code.google.com/p/zead 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License
 *
 **/

 
/** @see Zend_Auth **/
require_once 'Zend/Auth.php';

/** 
 * Class Zead_Auth 
 
 * @category   Zead
 * @package    Zead_Auth
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License
 */ 
class Zead_Auth extends Zend_Auth 
{
	/**
	 * Generate a new uniqid identity
	 * @return string
	 */
	public static function generateId()
	{	
		$string = "ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvxwyz123456890-_";
		$count = strlen($string);
		
		for ($i = 0; $i < 10; $i++) {
			$str = rand(0,$count);
			$chr = $string{$str};
			$id .= (($str % 2) == 1)  ? strtoupper($chr) : strtolower($chr);
		}
		
		return $id;
	}
}
